<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit" />
  <meta name="robots" content="index, follow" />
  <title>KELLY RIGHT ™</title>
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <link rel="shortcut icon" href="skin/fonts/favicon.ico" />
  <link rel="bookmark" href="skin/fonts/favicon.ico" />
  <link rel="stylesheet" type="text/css" href="skin/css/font-awesome.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="skin/css/bootstrap.min.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="skin/css/owl.carousel.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="skin/css/owl.theme.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="skin/css/settings.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="skin/css/style-red.css" media="screen" />
  <link rel="stylesheet" type="text/css" href="skin/css/tk.css" media="screen" />
  <script type="text/javascript" src="skin/js/jquery.min.js"></script>
  <script type="text/javascript" src="skin/js/bootstrap.min.js"></script>
  <script type="text/javascript" src="skin/js/template-web.js"></script>
  <script type="text/javascript" src="skin/js/owl.carousel.min.js"></script>
  <!-- 列表 -->
  <script type="text/html" id="likelist">
    {{each list v i}}
    <!-- 渲染的地方 -->
    <div class="blog-article hentry format-image" id="xrlist">
      <div class="mask" data-item="{{v}}"></div>
      <div class="row list-item" data-id="{{v.mlsId}}">
        <div class="col-xs-12 col-sm-6 lrow">
          <!-- 左 图 -->
          <div class="figure">
            <img class="pic" alt="" src="{{v.photos[0]}}" />
          </div>
        </div>

        <div class="col-xs-12 col-sm-6 rrow">
          <!-- 右 信息 -->
          <div class="entry-summary post-summary">

            <div class="entry-meta post-meta">

              <ul class="boxes">

                <li class="entry-date mn">
                  ${{v.listPrice}}
                </li>

                <li class="entry-date secli">
                  {{v.address.full}}
                </li>

                <li class="tags1">
                  <ul class="bx clearfix">
                    <li class="mx">{{v.address.city}}</li>
                    <li class="mx mlasts">{{v.address.state}}</li>
                  </ul>
                </li>

                <li class="byline author1 vcard">
                  <ul class="bx clearfix">
                    {{ if (v.property.bedrooms || v.property.Bedrooms) }}
                    <li class="m">{{v.property.bedrooms ? v.property.bedrooms : v.property.Bedrooms}} bd</li>
                    {{ /if }}

                    {{ if (v.property.bathsFull || v.property.bathrooms) }}
                    <li class="m">{{v.property.bathsFull ? v.property.bathsFull: v.property.bathrooms}} ba</li>
                    {{ /if }}

                    {{ if (v.property.area)}}
                    <li class="m">{{v.property.area}} sf</li>
                    {{ /if }}
                  </ul>
                </li>

                <li class="entry-date subtyoes">{{v.property.subType ? v.property.subType : ''}}</li>

              </ul>

              <div class="binfo">
                <ul class="bul clearfix">
                  {{ if (v.agent.photo) }}
                  <li class="pictu">
                    <img src="{{v.agent.photo}}" alt="" class="photo">
                  </li>
                  {{ /if }}

                  <li class="midder">
                    <p class="m-nm">{{v.agent.firstName}} {{v.agent.lastName}} </p>
                    <p class="m-company">{{v.office.servingName}}</p>
                  </li>

                  <li class="favioute" id="like">
                    {{if (v.isCollect != 1)}}
                    <img src="./skin/images/aixin.png" alt="">
                    {{else if(v.isCollect == 1)}}
                    <img src="./skin/images/aixin_full.png" alt="">
                    {{/if}}

                    <div class="mask" data-item="{{v}}"></div>
                  </li>
                </ul>
              </div>
            </div>

          </div>
        </div>
      </div>

    </div>
    {{/each}}
  </script>

  <!-- 所在页 -->
  <script type="text/html" id="page">
    {{each szpage v i}}
    <div class="row tline">
      <!-- 位置 -->
      <div class="col-sm-7 col-md-8 hidden-xs location">
        <span>
          <a href='./index.html' class="color">Real Estate for Sale</a>
          <span class="dy"> > </span>
          <a href='javascript:;' class="color thesear">{{v.s1}}</a>
          <span class="dy"> > </span>
          <span>{{v.s2}}, ON</span>
        </span>
      </div>

      <!-- 搜索 -->
      <div class="col-sm-5 col-md-4 bcid-cat">
        <input type="text" class="sr" placeholder="Where are you looking for?">
        <div class="rig">
          <i class="fa fa-search"></i>
        </div>
      </div>

      <!-- 移动端 位置 -->
      <div class="col-sm-7 col-md-8 hidden-sm hidden-md hidden-lg location">
        <span>
          <a href='index.html' class="color">Real Estate for Sale</a>
          <span class="dy"> > </span>
          <a href='javascript:;' class="color thesear">{{v.s1}}</a>
          <span class="dy"> > </span>
          <span>{{v.s2}}, ON</span>
        </span>
      </div>

    </div>
    {{/each}}
  </script>

  <!-- 分页 -->
  <script type="text/html" id="pagelist">
    {{if (pageList.length)}}
    <div id="pages">

      <ul class="boxs clearfix">

        <!-- 首页 -->
        {{ if (pageList.length > 1) }}
        <li class="items sypages">
          <a href='javascript:void(0);' class="homePage">
            <img src="./skin/images/zuoshuangjiantou.png" class="pic" alt="">
          </a>
        </li>
        {{/if}}

        <!-- 上1页 -->
        {{ if (pageList.length > 1) }}
        <li class="items">
          <a href='javascript:void(0);' class="larr">
            <img src="./skin/images/zuojiantou.png" class="pic" alt="">
          </a>
        </li>
        {{/if}}

        <!-- 页码 -->
        {{each pageList v i}}
        {{ if (pageList.length <= 4) }}

        {{if (i == 0)}}
        <li class="items tpage active">
          <a href="javascript:void(0);">{{v}}</a>
        </li>
        {{ else if (i > 0) }}

        <li class="items tpage">
          <a href="javascript:void(0);">{{v}}</a>
        </li>
        {{/if}}

        {{ else if (pageList.length > 4) }}
        {{if i < 2}}
        {{ if (i == 0) }}
        <li class="items tpage active">
          <a href="javascript:void(0);">{{v}}</a>
        </li>
        {{ else if (i != 0)}}
        <li class="items tpage">
          <a href="javascript:void(0);">{{v}}</a>
        </li>
        {{ /if }}
        {{/if}}

        {{if i == 2}}
        <li class="items tpage">
          <a href="javascript:void(0);">...</a>
        </li>
        {{/if}}

        {{if i == pageList.length-1}}
        <li class="items tpage">
          <a href="javascript:void(0);">{{i+1}}</a>
        </li>
        {{/if}}

        {{ /if }}

        {{/each}}

        <!-- 下1页 -->
        {{ if (pageList.length > 1) }}
        <li class="items">
          <a href='javascript:void(0);' class="rarr">
            <img src="./skin/images/youjiantou.png" class="pic" alt="">
          </a>
        </li>
        {{/if}}

        <!-- 末页 -->
        {{ if (pageList.length > 1) }}
        <li class="items">
          <a href='javascript:void(0);' class="lastPage">
            <img src="./skin/images/youshuangjiantou.png" class="pic" alt="">
          </a>
        </li>
        {{/if}}

      </ul>

    </div>
    {{/if}}
  </script>

</head>

<body>
  <div id="container" class="collection" style="background: #F9FBFC;">
    <!-- 导航栏 -->
    <header class="clearfix" id="header-sec">
      <nav class="navbar navbar-default navbar-fixed-top pbox" role="navigation">

        <div class="container-fluid">

          <!-- 左 logo -->
          <div class="navbar-header">
            <!-- 移动端按钮 -->
            <a class="navbar-toggle collapsed mmenu-btn" href="#mmenu">
              <!-- <span class="sr-only">Toggle navigation</span>
                  <span class="icon-bar"></span> 
                  <span class="icon-bar"></span> 
                  <span class="icon-bar"></span>  -->
              <img src="./skin/images/mobile-qttab.png" alt="">
            </a>

            <!-- pc -->
            <a class="navbar-brand hidden-xs hidden-sm hiddenMobEle" href="javascript:;">
              <img src="./skin/images/logo.png" alt="" class="logo" />
            </a>

            <!-- 移动 -->
            <a class="navbar-brand hidden-md hidden-lg hiddenPccEle" href="javascript:;">
              <img src="./skin/images/log-logo.png" alt="" class="logo" />
            </a>
          </div>

          <!-- tab -->
          <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">

            <ul class="nav navbar-nav navbar-left" id="navigation1">
              <li class="Lev1">
                <a href="./index.html" class='menu1 active'>Homes for Sale </a>
              </li>

              <li class="Lev1">
                <a href="./aboutCharlotte.html" class='menu1'>About Charlotte</a>
              </li>

              <li class="Lev1">
                <a href="./contactUs.html" class='menu1'>Contact Us</a>
              </li>

              <!-- <li class="Lev1">
                    <a href="./openHouses.html" class="menu1">Open Houses</a>
                  </li> -->

              <!-- <li class="Lev1">
                    <a href="javascript:void(0);" class="menu1">New Developments</a>
                  </li>
    
                  <li class="Lev1">
                    <a href="javascript:void(0);" class="menu1">Buildings
                    </a>
    
                  </li>
    
                  <li class="Lev1">
                    <a href="javascript:void(0);" class="menu1">Find an Agent
                    </a>
    
                  </li>
    
                  <li class="Lev1">
                    <a href="javascript:void(0);" class="menu1">Blog
                    </a>
                  </li> -->
            </ul>

            <ul class="nav navbar-nav navbar-right" id="navigation2">

              <li class="Lev1">
                <a href="./sign-up.html" class="menu1 giwid">SIGN UP</a>
              </li>

              <li class="Lev1">
                <a href="javascript:void(0);" class="menu1 giwid activeLogin">LOG IN</a>
              </li>

              <li class="afterLogin" style="display: none">
                <a class="ele-a" href="#">
                  <!-- 注册时输入的用户名 -->
                  <span class="atext">username</span>
                  <div class="arr-down">
                    <img src="./skin/images/jiantouxia.png" alt="">
                  </div>
                </a>

                <!-- 用户相关 -->
                <ul class="aboutUser">
                  <li class="item">
                    <a href="./account-details.html" class="in">
                      <span class="">Account Details</span>
                    </a>
                  </li>

                  <li class="item" id="userFavourite">
                    <a href="./collection.html" class="in">
                      <span class="">Favorites</span>
                      <span class="favNum">0</span>
                    </a>
                  </li>

                  <li class="item">
                    <p class="signOut">Sign Out</p>
                  </li>
                </ul>

              </li>

            </ul>

          </div>

        </div>

      </nav>
    </header>

    <!-- sign in -->
    <div class="signin none">
      <div class="content">
        <!-- 关闭 -->
        <div class="closebtn"></div>

        <!-- logo -->
        <div class="dllogos">
          <div class="photo">
            <img src="./skin/images/log-logo.png" class="thepicture" alt="">
          </div>
        </div>

        <!-- 提示登录 -->
        <!-- <div class="tsinfo">Please login to your account before seeing the information. </div> -->

        <!-- 用户 -->
        <div class="userinfo login-normal" id="userInfo">
          <form action="">
            <!-- 导航 -->
            <div class="row navbares" id="signNav">

              <div class="col-xs-4 col-xs-offset-4 col-sm-2 col-sm-offset-7 up">
                <span>Sign Up</span>
              </div>

              <div class="col-xs-4 col-sm-2 log active">
                <span>Log In</span>
              </div>

            </div>

            <!-- sign up -->
            <div class="row usersignup">
              <!-- <div class="row free">
                  Create a FREE account to save searches and track your favourite homes. Already have an account? Click
                  the Log In tab.
                </div> -->

              <!-- 提示 -->
              <div class="row upalert" id="upginTips">You have signed up successfully, please log in to account.</div>

              <div class="row name">
                <div class="title">Name</div>
                <input type="text" placeholder="" name="" id="input_name1">
                <div class="ts">cannot be blank</div>
              </div>

              <div class="row email">
                <div class="title">Email</div>
                <input type="email" placeholder="" name="" id="input_email1">
                <div class="ts">please enter the correct email</div>
                <div class="exist">account already exists</div>
              </div>

              <div class="row password">
                <div class="title">Phone Number <span class="usedfor">(Used for Password)</span></div>
                <input type="text" placeholder="" name="" id="input_password1">
                <div class="ts">cannot be blank</div>
              </div>

              <!-- <div class="row confirm">
                  <div class="title">Confirm Password</div>
                  <input type="password" placeholder="" name="" id="input_confirm1">
                  <div class="ts">does not match password</div>
                </div> -->

              <!-- 确定 -->
              <div class="row upsubmit">
                <p class="tj active">Sign Up</p>
              </div>

              <div class="row confirm2">
                <!-- <input type="checkbox" name="" value="0" id=""> -->
                <div class="pictur active"></div>
                Get emailed when we find more properties that suit your tastes! We'll notify you daily of new listings
                &
                price changes.
              </div>

              <div class="row bottomTiS">
                By clicking continue or sign up, you agree to our linked <span class="hs">Terms of
                  Use</span> and <span class="hs">Privacy Policy</span>
              </div>
            </div>

            <!-- log in -->
            <div class="row usersignin">
              <!-- <div class="row tit">
                  <p>
                    Don't have an account? Click on the Sign Up tab.
                  </p>
                </div> -->

              <!-- 提示 -->
              <div class="row alert" id="loginTips">Invalid email or password.</div>

              <div class="row email">
                <div class="title">Email</div>
                <input type="email" name="" placeholder="" id="input_email">
                <div class="ts">Please enter the correct email</div>
              </div>

              <div class="row password">
                <div class="title">Phone Number <span class="usedfor">(Used for Password)</span></div>
                <input type="text" name="" placeholder="" id="input_password">
                <div class="ts">cannot be blank</div>
              </div>

              <div class="row loginsubmits">
                <p class="tj active">Log In</p>
              </div>

              <!-- 是否保持状态 忘记密码 -->
              <div class="row combine">
                <!-- 保持状态 -->
                <div class="col-xs-12 col-sm-6 rad">
                  <!-- <input type="checkbox" value="0" name="agree" id="check"> -->
                  <div class="pictur active"></div>
                  Stay logged in
                </div>

                <div class="col-xs-12 col-sm-6 access">
                  <p>
                    <a href="javascript: void(0);" id="forgetword">Can't access your account?</a>
                  </p>
                </div>

              </div>


            </div>

          </form>

        </div>

        <!-- 忘记密码 -->
        <div class="row findpassword login-find" style="display: none;">
          <div class="row tit">
            <p>
              Enter the email address you registered with and your password will be sent to you.
            </p>
          </div>

          <!-- 提示 -->
          <div class="row alert" id="findpaTips">Invalid email.</div>

          <div class="row email" id="emaFi">
            <div class="title">Email</div>
            <input type="email" name="" placeholder="" id="sendEmail">
            <div class="ts">Please enter the correct email.</div>
          </div>

          <div class="row send" id="sendPass">
            <p class="tj active">Send Password</p>
          </div>

          <div class="row back">
            <p>
              <a href="javascript: void(0);">Back to log in page</a>
            </p>
          </div>

        </div>

      </div>
    </div>

    <!-- 所在页 -->
    <!-- <div class="breadcrumb-wrapper">
      <div class="container" id="pagesinthe">
      </div>
    </div> -->

    <!-- 内容 -->
    <div class="page-container mainpage collect-content" id="innerpage-wrap">
      <!-- 顶部nav -->
      <div class="pageNav">
        <div class="container nav clearfix">
          <div class="header">My Account</div>

          <ul class="list-ul">
            <li>
              <a href="./account-details.html">Account Details</a>
            </li>

            <li class="active">
              <a href="javascript:void(0);">Favorites</a>
            </li>

          </ul>

        </div>
      </div>

      <div class="container">

        <div class="row">

          <div class="main col-md-8 col-md-offset-2 inner-left" role="main">
            <!-- 标题 -->
            <div class="topTitle">
              <div class="row txt">My Favorite Homes</div>
            </div>

            <!-- 展示 -->
            <article class="blog-wrap" id="listbox"></article>

            <!-- 无数据 -->
            <div class="nolist" id="noDatas">You currently have no favorite homes.</div>

            <!-- 分页 -->
            <div class="pagination-wrap" id="pageing"></div>
          </div>

        </div>
      </div>
    </div>

    <!-- 底部 -->
    <div class="commonfoot">
      <div class="container  hidden-xs hidden-sm">

        <div class="row">

          <div class="col-md-4 col-lg-4  foot-contact rightbox">
            <div class="f-contact ltxt">
              <p> <a href="javascript:void(0);">© 2019 Real Estate Website by DotCom Agents</a></p>
              <p> <a href="javascript:void(0);">All rights reserved. Privacy and Terms</a></p>
            </div>
          </div>

          <div class="col-md-4 col-lg-4 foot-contact">
            <div class="f-contact">
              <ul class="box clearfix">
                <li>
                  <a href="javascript:void(0);">
                    <img src="./skin/images/bottom1.png" alt="" class="pic">
                  </a>
                </li>
                <li>
                  <a href="javascript:void(0);">
                    <img src="./skin/images/bottom2.png" alt="" class="pic">
                  </a>
                </li>
                <li>
                  <a href="javascript:void(0);">
                    <img src="./skin/images/bottom3.png" alt="" class="pic">
                  </a>
                </li>
              </ul>
            </div>
          </div>

          <div class="col-md-4 col-lg-4 foot-contact">
            <div class="f-contact rtxt">
              <p> <a href="./aboutCharlotte.html">ABOUT US</a></p>
              <p> <a href="./contactUs.html">CONTACT US</a></p>
            </div>
          </div>

        </div>

      </div>

      <div class="container hidden-md  hidden-lg">

        <div class="row">

          <div class="col-xs-12 col-sm-12 foot-contact">
            <div class="f-contact one">
              <ul class="about clearfix">
                <li><a href="./aboutCharlotte.html">ABOUT US</a></li>
                <li><a href="./contactUs.html">CONTACT US</a></li>
              </ul>
            </div>
          </div>

          <div class="col-xs-12 col-sm-12 foot-contact">
            <div class="f-contact two">
              <ul class="box clearfix">
                <li>
                  <a href="javascript:void(0);">
                    <img src="./skin/images/bottom1.png" alt="" class="pic">
                  </a>
                </li>
                <li>
                  <a href="javascript:void(0);">
                    <img src="./skin/images/bottom2.png" alt="" class="pic">
                  </a>
                </li>
                <li>
                  <a href="javascript:void(0);">
                    <img src="./skin/images/bottom3.png" alt="" class="pic">
                  </a>
                </li>
              </ul>
            </div>
          </div>

          <div class="col-xs-12 col-sm-12  foot-contact">
            <div class="f-contact three">
              <p> <a href="javascript:void(0);">© 2019 Real Estate Website by DotCom Agents</a></p>
              <p> <a href="javascript:void(0);">All rights reserved. Privacy and Terms</a></p>
            </div>
          </div>
        </div>

      </div>
    </div>

    <!-- 返回顶部 -->
    <div class="commongoback" id="toTop">
      <div class="icon">
        <img src="./skin/images/up.png" />
      </div>
      top
    </div>

    <!-- 加载中 -->
    <div class="load">
      <div class="ing">
        <img src="./skin/images/jiazaizhong.gif" class="photo" alt="">
      </div>
    </div>

    <!-- 提示: 登录成功 -->
    <div class="success-logIn">
      <img class="pic" src="./skin/images/dui.png" alt="">
      <span class="txt">Logged in successfully.</span>
      <div class="close">
        <img src="./skin/images/guanbi.png" alt="">
      </div>
    </div>

    <!-- 提示: 退出成功 -->
    <div class="success-signOut">
      <img class="pic" src="./skin/images/dui.png" alt="">
      <span class="txt">Signed out successfully.</span>
      <div class="close">
        <img src="./skin/images/guanbi.png" alt="">
      </div>
    </div>

    <!-- 提示: 到邮箱找回密码 -->
    <div class="findmailbox">
      <img class="pic" src="./skin/images/dui.png" alt="">
      <span class="txt">You will receive an email with instructions about how to reset your password in a few
        minutes.</span>
      <div class="close">
        <img src="./skin/images/guanbi.png" alt="">
      </div>
    </div>

  </div>
  <script type="text/javascript" src="skin/js/jquery.migrate.js"></script>
  <!--<script type="text/javascript" src="skin/js/jquery.bxslider.min.js"></script>-->
  <script type="text/javascript" src="skin/js/jquery.imagesloaded.min.js"></script>
  <!-- <script type="text/javascript" src="/skin/js/retina-1.1.0.min.js"></script> -->
  <script type="text/javascript" src="skin/js/jquery.themepunch.tools.min.js"></script>
  <script type="text/javascript" src="skin/js/jquery.themepunch.revolution.min.js"></script>
  <script type="text/javascript" src="skin/js/base64.min.js"></script>
  <script type="text/javascript" src="skin/js/base.js"></script>
  <script type="text/javascript" src="skin/js/axios.min.js"></script>
  <script type="text/javascript" src="skin/js/script.js"></script>

  <!-- 移动端导航 -->
  <nav id="mmenu" class="noDis">
    <div class="mmDiv">

      <!-- 关闭 -->
      <div class="closefixed closemenu">
        <img src="./skin/images/close_pic.png" alt="" style="width: 20px; height: 20px;">
      </div>

      <!-- sign log -->
      <div class="MMhead">
        <ul class="users clearfix">
          <!-- 登录前 -->
          <li class="before before1">
            <a href="./sign-up.html" class="noblock logins">Sign Up</a>
          </li>

          <li class="before">
            <a href="javascript:;" class="noblock activeLogin">Log In</a>
          </li>

          <!-- 登录后 -->
          <!-- Account Details -->
          <li class="afters afters1">
            <a href="./account-details.html" class="item account">
              <img src="./skin/images/log-ren.png" class="pic" alt="">
            </a>
          </li>

          <!-- Favourites -->
          <li class="afters" style="background: #F39800;">
            <a href="./collection.html" class="item account">
              <img src="./skin/images/log-aixin.png" class="pic" alt="">
              <span class="num" id="faNum">0</span>
            </a>
          </li>

        </ul>

      </div>


      <!-- nav -->
      <ul class="mobnavbar">
        <li class="box">
          <a href="./index.html">Homes for Sale</a>
        </li>

        <li class="box">
          <a href="./aboutCharlotte.html">About Charlotte</a>
        </li>

        <li class="box">
          <a href="./contactUs.html">Contact Us</a>
        </li>

        <!-- <li class="box">
            <a href="./openHouses.html" class="m-menu1">Open Houses</a>
          </li> -->

        <!-- <li class="box">
            <a href="javascript:;" class="m-menu1">New Developments</a>
          </li>
  
          <li class="box">
            <a href="" class="m-menu1">Buildings</a>
          </li>
  
          <li class="box">
            <a href="" class="m-menu1">Find an Agent</a>
          </li>
          
          <li class="box">
            <a href="" class="m-menu1">Find an Agent</a>
          </li>
  
          <li class="box">
            <a href="javascript:;" class="m-menu1">Blog</a>
          </li> -->
      </ul>

      <!-- sign out 登录后出现 -->
      <div class="footout">
        <a class="" href="javascript:;">Sign Out</a>
      </div>

    </div>
  </nav>

  <link type="text/css" rel="stylesheet" href="skin/css/jquery.mmenu.all.css" />
  <script type="text/javascript" src="skin/js/jquery.mmenu.all.min.js"></script>
  <script type="text/javascript">
    $(function ($) {
      var baseUrl = localStorage.getItem('baseUrl');
      var salesList = [];
      var showList = [];
      var storageList = [];
      var currentPg = 1;
      var totalPages = 1;

      // 获取当前地址
      var projectUrl = '';;
      (function getUrl() {
        var currUrl = window.location.href;
        var idx = currUrl.lastIndexOf('/') + 1;
        var c = currUrl.substr(0, idx);
        projectUrl = c;
      })();

      // 1 加载中
      $('.load').hide();
      $('.load').show();

      // 用户有没有登录
      (function islogin() {
        var token = localStorage.getItem('token');
        if (!token) {
          // 回首页
          window.location.href = projectUrl + 'index.html';
          return;
        }
      })();


      // 2 money
      function formatNum(str) {
        var str = typeof str == 'string' ? str : str + '';
        var newStr = "";
        var count = 0;
        // 当数字是整数
        if (str.indexOf(".") == -1) {
          for (var i = str.length - 1; i >= 0; i--) {
            if (count % 3 == 0 && count != 0) {
              newStr = str.charAt(i) + "," + newStr;
            } else {
              newStr = str.charAt(i) + newStr;
            }
            count++;
          }
          str = newStr; //自动补小数点后两位  + ".00"
          return str;
        }
        // 当数字带有小数
        else {
          for (var i = str.indexOf(".") - 1; i >= 0; i--) {
            if (count % 3 == 0 && count != 0) {
              newStr = str.charAt(i) + "," + newStr;
            } else {
              newStr = str.charAt(i) + newStr; //逐个字符相接起来
            }
            count++;
          }
          str = newStr + (str + "00").substr((str + "00").indexOf("."), 3);
          return str;
        }
      }

      // 3 请求 -- 获取收藏列表
      function getList() {

        axios.post(baseUrl + '/mclient/member/collectList', {}, {
            headers: {
              'token': localStorage.getItem('token')
            }
          })

          .then(function (res) {

            if (res.data.code == 0 && res.data.msg == "success") {


              var list = res.data.results;

              showlist = [];

              if (list && list.length) {
                list.map((item, index, arr) => {
                  var property = JSON.parse(item.propertiesData);
                  storageList.push(property);
                })

                console.log('-----获取收藏列表成功-----', storageList);

              }

              // 处理
              if (storageList && storageList.length) {
                storageList.map((item, index, arr) => {
                  if (index >= (currentPg - 1) && index < 10 * currentPg) {
                    showList.push(item);
                  }
                })
              }

              var html = template('likelist', {
                list: showList
              });
              $('#listbox').html(html);

              $('.load').hide();

              // 无数据
              if (!showList.length) {
                $('.collection #noDatas').show();
              } else {
                $('.collection #noDatas').hide();
              }

              // 总页数 -- 返回
              var pagelength = Math.ceil(storageList.length / 10);
              totalPages = +pagelength; // 总页数

              var pLists = [];
              for (var i = 0; i < totalPages; i++) {
                pLists.push(i + 1);
              }

              var html6 = template('pagelist', {
                pageList: pLists
              });
              $('.collection #pageing').html(html6);


            } else {
              console.log('-----获取收藏列表不成功-----', res);
            }

          })

          .catch(function (res) {
            console.log('-----请求收藏列表接口失败-----', res);
          });

      };

      getList();

      // 4 点击--每项
      $('#listbox').on('click', '.list-item', function (e) {
        var id = $(this).data().id;
        // 跳转详情页
        // window.open(`./saleDetail.html?id=${id}`);
        window.location.href = `./saleDetail.html?id=${id}`;

      })

      // 5 点击收藏
      $('#listbox').on('click', '.mask', function (e) {
        e.stopPropagation();

        // 前提--登录
        if (localStorage.getItem('token')) {

          var item1 = $(this).data().item;

          // 请求
          var params5 = {
            'mlsId': item1.mlsId + '',
            'propertiesData': item1,
            'actionDo': item1.isCollect == 1 ? -1 : 1 // -1 取消
          };

          axios.post(baseUrl + '/mclient/member/collectProperties', params5, {
              headers: {
                'token': localStorage.getItem('token')
              }
            })

            .then(function (res) {

              if (res.data.code == 0 && res.data.msg == "success") {
                console.log('-----收藏成功-----', res);

                // api中无字段判断
                // 1.1 刷新列表
                var showList1 = showList;
                showList1.map((item, index, arr) => {
                  if (item1.mlsId == item.mlsId) {
                    item.isCollect = (item.isCollect == 1 ? -1 : 1);
                  }
                })

                showList = showList1;

                // 1.2 渲染
                var html = template('likelist', {
                  list: showList
                });
                $('#listbox').html(html);

                // 2 获取收藏数
                getLikeList();

              } else {
                console.log('-----收藏不成功-----', res);
              }

            })

            .catch(function (res) {
              console.log('-----请求收藏接口失败-----', res);
            });

        } else {

          // 未登录--提示
          // 回首页
          window.location.href = projectUrl + 'index.html';
          return;
          // $('.signin').show();
          // $('.signin .content').slideDown();
        }

      })

      // 6 分页
      // 渲染
      function exhibition(current) {
        console.log('-----当前页------', current);

        // 处理
        showList = [];
        if (storageList && storageList.length) {
          storageList.map((item, index, arr) => {
            if (index >= (10 * current - 10) && index < 10 * current) {
              showList.push(item);
            }
          })
        }

        var html = template('likelist', {
          list: showList
        });
        $('#listbox').html(html);

        // top
        $('body,html').animate({
          scrollTop: 0
        }, 0)

      }

      // 6.1 当前所在页
      $('.collection #pageing').on('click', '.tpage', function () {
        var tx = $(this).find('a').text();
        if (tx != '...') {
          // active
          $(this).addClass('active').siblings('.tpage').removeClass('active');
          currentPg = +tx;

          // 显示
          exhibition(currentPg);

        }
      })

      // 6.2 点击--上一页
      $('.collection #pageing').on('click', '.larr', function () {
        // 1 数字
        var current = +currentPg;
        var reduce = 1;
        if (current <= 1) {
          reduce = 1;
          return;
        } else {
          reduce = current - 1;
        }

        currentPg = reduce;

        // 1.1 当前显示数字
        $('.collection #pageing .tpage').each(function (index, ele) {
          $(this).removeClass('active');

          if ($(this).find('a').text() == reduce) {
            $(this).addClass('active');
          }

        })

        exhibition(reduce);

      })

      // 6.3 点击 -- 下一页
      $('.collection #pageing').on('click', '.rarr', function () {
        // 1 数字
        var current = +currentPg;
        var list = salesList;
        var add = 1;
        if (current >= totalPages) {
          add = totalPages;
          return;

        } else {
          add = current + 1;
        }

        currentPg = add;

        // 1.1 当前显示数字
        $('.collection #pageing .tpage').each(function (index, ele) {
          $(this).removeClass('active');
          if ($(this).find('a').text() == add) {
            $(this).addClass('active');
          }
        })

        exhibition(add);

      })

      // 6.4 点击 -- 首页
      $('.collection #pageing').on('click', '.homePage', function () {
        // 1 数字
        var current = 1;
        currentPg = 1;

        // 1.1 当前显示数字
        $('#pageing .tpage').each(function (index, ele) {
          $(this).removeClass('active');

          if ($(this).find('a').text() == current) {
            $(this).addClass('active');
          }

        })

        exhibition(current);

      })

      // 6.5 点击 -- 末页
      $('.collection #pageing').on('click', '.lastPage', function () {

        // 1 数字
        var current = +totalPages;
        currentPg = +totalPages;

        // 1.1 当前显示数字
        $('#pageing .tpage').each(function (index, ele) {
          $(this).removeClass('active');

          if ($(this).find('a').text() == current) {
            $(this).addClass('active');
          }

        })

        exhibition(current);

      })

      // 9 获取收藏数
      var likeListResult = [];

      function getLikeList() {

        axios.post(baseUrl + '/mclient/member/collectList', {}, {
            headers: {
              'token': localStorage.getItem('token')
            }
          })

          .then(function (res) {

            if (res.data.code == 0 && res.data.msg == "success") {
              console.log('-----获取收藏列表成功-----', res);
              likeListResult = res.data.results;

              if (likeListResult) {
                $('.aboutUser #userFavourite .favNum').text(likeListResult.length);
                $('.users .afters #faNum').text(likeListResult.length); //移动端
              }

            } else {
              console.log('-----获取收藏列表不成功-----', res);
            }

          })

          .catch(function (res) {
            console.log('-----请求收藏列表接口失败-----', res);
          });

      };



    });
  </script>
</body>

</html>